const Router = require('koa-router');
const router = new Router();
const bodyparser = require('koa-bodyparser')
const MessageCenter = require('../entiity/MessageCenter');

//调用中间件，拿到前端post数据
router.use(bodyparser());


router.post('/search', async (ctx)=>{
    const roomId = ctx.request.body.roomId;
    const userName = ctx.request.body.userName;
    //创建messageCenter实例
    const messageCenter = new MessageCenter(ctx);
    await messageCenter.subscribe(roomId, userName);
})

module.exports = router;